<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="投标人名称">
              <a-input placeholder="请输入投标人名称" v-model="queryParam.bidderName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="缴纳状态">
              <a-input placeholder="请输入缴纳状态" v-model="queryParam.marginPayStatus"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="10" :lg="11" :md="12" :sm="24">
              <a-form-item label="缴纳时间">
                <j-date
                  :show-time="true"
                  date-format="YYYY-MM-DD HH:mm:ss"
                  placeholder="请选择开始时间"
                  class="query-group-cust"
                  v-model="queryParam.marginPayDate_begin"
                ></j-date>
                <span class="query-group-split-cust"></span>
                <j-date
                  :show-time="true"
                  date-format="YYYY-MM-DD HH:mm:ss"
                  placeholder="请选择结束时间"
                  class="query-group-cust"
                  v-model="queryParam.marginPayDate_end"
                ></j-date>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: true }"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <template>
            <j-upload v-model="record.fileUrl"></j-upload>
          </template>
        </span>
      </a-table>
    </div>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@/api/manage'

export default {
  name: 'ExBondPaysituationList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {},
  data() {
    return {
      description: '费用缴纳查询',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '标段编号',
          align: 'center',
          dataIndex: 'bidSectionCode',
        },
        {
          title: '投标人名称',
          align: 'center',
          dataIndex: 'bidderName',
        },
        {
          title: '投标人代码',
          align: 'center',
          dataIndex: 'bidderOrgCode',
        },
        {
          title: '缴纳金额',
          align: 'center',
          dataIndex: 'marginAmount',
        },
        {
          title: '缴纳币种',
          align: 'center',
          dataIndex: 'marginCurrency',
        },
        {
          title: '缴纳时间',
          align: 'center',
          dataIndex: 'marginPayDate',
        },
        {
          title: '保证金缴纳账户',
          align: 'center',
          dataIndex: 'marginPayAccount',
        },
        {
          title: '保证金缴纳户名',
          align: 'center',
          dataIndex: 'marginPayAccountName',
        },
        {
          title: '保证金入账账户',
          align: 'center',
          dataIndex: 'marginReceiveAccount',
        },
        {
          title: '保证金入账户名',
          align: 'center',
          dataIndex: 'marginReceiveAccountName',
        },
        {
          title: '缴纳状态',
          align: 'center',
          dataIndex: 'marginPayStatus',
        },
        {
            title: '上传缴费凭证',
            dataIndex: 'fileUrl',
            align: 'center',
            scopedSlots: { customRender: 'action' },
          },
      ],
      url: {
        list: '/exBond/exBondPaysituation/list',
        delete: '/exBond/exBondPaysituation/delete',
        deleteBatch: '/exBond/exBondPaysituation/deleteBatch',
        exportXlsUrl: '/exBond/exBondPaysituation/exportXls',
        importExcelUrl: 'exBond/exBondPaysituation/importExcel',
      },
      dictOptions: {},
      superFieldList: [],
      projectId: null,
    }
  },
  created() {
    this.getSuperFieldList()
    this.projectId = this.$route.query.projectId
    this.queryParam.projectId = this.projectId 
    this.loadData()
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    initDictConfig() {},
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'bidSectionCode', text: '标段（包）编号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'unifiedDealCode', text: '统一交易标识码 ', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bidSectionId', text: '标段（包）标识码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bidderName', text: '投标人名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bidderOrgCode', text: '投标人代码 ', dictCode: '' })
      fieldList.push({ type: 'BigDecimal', value: 'marginAmount', text: '缴纳金额', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginCurrency', text: '缴纳币种 ', dictCode: '' })
      fieldList.push({ type: 'datetime', value: 'marginPayDate', text: '缴纳时间 ' })
      fieldList.push({ type: 'string', value: 'marginPayAccount', text: '保证金缴纳账户', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginPayAccountName', text: '保证金缴纳户名', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginReceiveAccount', text: '保证金入账账户', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginReceiveAccountName', text: '保证金入账户名', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginPayStatus', text: '缴纳状态 ', dictCode: '' })
      fieldList.push({ type: 'string', value: 'marginPayGuid', text: '保证金入账唯一标识 ', dictCode: '' })
      fieldList.push({ type: 'string', value: 'platformCode', text: '交易系统标识码 ', dictCode: '' })
      fieldList.push({ type: 'datetime', value: 'dataTimestamp', text: '数据时间戳 ' })
      this.superFieldList = fieldList
    },
    loadData(arg,pageSize=10) {
      if (!this.projectId) {
        return
      }
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1
      }
      var params = this.getQueryParams() //查询条件
      params.projectId = this.projectId
      params.pageSize = pageSize
      this.loading = true
      return getAction(this.url.list, params)
        .then((res) => {
          if (res.success) {
            //update-begin---author:zhangyafei    Date:20201118  for：适配不分页的数据列表------------
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
            return this.dataSource;
            //update-end---author:zhangyafei    Date:20201118  for：适配不分页的数据列表------------
          } else {
            this.$message.warning(res.message)
          }
        })
        .finally(() => {
          this.loading = false
        })
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>